import random

from faker import Faker

faker = Faker(locale='zh_CN')


# 生成SQL插入语句
def generate_insert_sql(num_entries):
    values_part = ""
    for i in range(1, num_entries + 1):
        values_part += f"('{faker.name()}', '{random.randint(0, 1)}', {random.randint(0,100)}, '{faker.address()}', '{faker.phone_number()}'),\n"
        # 移除最后一个逗号和换行符
    values_part = values_part[:-2]
    sql = f"""  
    INSERT INTO USER_INFO (user_name, user_sex, user_age, user_address, user_phone) VALUES  
    {values_part};  
    """
    return sql


# 生成100条数据的插入SQL
insert_sql = generate_insert_sql(100)
print(insert_sql)
